package com.kitchen.ui.controls.account
{
	import com.kitchen.AbstractIcon;
	
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;

	public class NumberItem extends Sprite
	{
		public static const N_RED:int = 1;
		public static const N_YELLOW:int = 2;
		public static const N_BLACK:int = 3;
		
		private var numIcon:AbstractIcon;
		public var h:Number;
		public var w:Number;
		public var num:int;
		
		public function NumberItem(num:int, main:BitmapData, type:int)
		{
			super();
			this.h = 18;
			this.w = 18;
			this.num = num;
			this.layout(main, type);
			var lmask:Shape = new Shape();
			lmask.graphics.beginFill(0xffffff, 1);
			lmask.graphics.drawRect(0, 0, 18, 18);
			lmask.graphics.endFill();
			this.mask = lmask;
			this.addChild(lmask);
		}
		
		private function layout(main:BitmapData, type:int):void{
			if(type == NumberItem.N_RED){
				this.numIcon = new RedNumberIcon(main) as AbstractIcon;
			}else if(type == NumberItem.N_BLACK){
				this.numIcon = new BlackNumberIcon(main) as AbstractIcon;
			}else if(type == NumberItem.N_YELLOW){
				this.numIcon = new YellowNumberIcon(main) as AbstractIcon;
			}else{
				throw new Error('Number type is Error', 500);
			}
			this.numIcon.x = -(this.num*18);
			this.addChild(this.numIcon);
		}
		
		public function show(num:int):void{
			this.numIcon.x = -(num*18);
		}
		
	}
}